<template>
  <div class="allCinemas">
    <van-card
      v-for="item in cinemas"
      :key="item.id"
      @click="toCinemaDetail(item.id)"
      class="myCard"
    >
      <template #title>
        <div class="title">
          <div class="name">{{ item.nm }}</div>
          <div class="price">
            <span class="priceNum"> {{ item.sellPrice }}</span>
            <span style="font-size: 12px"> 元起</span>
          </div>
        </div>
      </template>
      <template #desc>
        <div class="desc">
          <div class="address">
            {{ item.addr }}
          </div>
        </div>
      </template>
      <template #tags>
        <div class="tags">
          <span v-if="item.tag.allowRefund" class="refund">&nbsp;退&nbsp;</span>
          <span v-if="item.tag.deal" class="deal">&nbsp;改签&nbsp;</span>
          <span v-if="item.tag.snack" class="snack">&nbsp;小吃&nbsp;</span>
          <span v-if="item.tag.vipTag" class="vip">&nbsp;折扣卡&nbsp;</span>
        </div>
      </template>
      <template #bottom>
        <div class="bottom">
          {{ item.promotion.cardPromotionTag }}
        </div>
      </template>
    </van-card>
  </div>
</template>
<script>
export default {
  props: ["cinemas", "movieId"],
  data() {
    return {}
  },
  methods: {
    toCinemaDetail(id) {
      if (this.movieId) {
        this.$router.push({
          path: `/cinemaDetail/${id}/${this.movieId}`
        })
      } else {
        this.$router.push({
          path: `/cinemaDetail/${id}`
        })
      }
    }
  }
}
</script>
<style lang="scss" scoped>
.allCinemas {
  .myCard {
    .title {
      font-size: 16px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      .name {
        width: 280px;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
      }
      .price {
        text-align: center;
        color: red;
      }
    }
    .desc {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-top: 6px;
      font-size: 13px;
      color: #666;
      .address {
        width: 280px;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
      }
    }
    .tags {
      margin: 4px 0;
      span {
        margin-right: 5px;
      }
      .refund,
      .deal {
        color: #77ffee;
        border: 1px solid #77ffee;
      }
      .snack,
      .vip {
        color: #ff7744;
        border: 1px solid #ff7744;
      }
    }
    .bottom {
      color: #666;
      font-size: 12px;
    }
  }
}
</style>
